#需要安装 opencv-contrib-python
import cv2 as cv

img = cv.imread("assets/book.jpg")
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)

sift = cv.xfeatures2d.SIFT_create()
keypoints, descriptors = sift.detectAndCompute(gray, None)

cv.drawKeypoints(img, keypoints, img, (51, 163, 236), cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
cv.imshow("img", img)
cv.waitKey(0)